import trim from './trim';

/**
 * @name: 判断字符串是否可以转一个合法number
 * @param {String|Number} value
 * @return {boolean}
 */
export default function isNumber(value) {
  if (typeof value === 'number') return true;
  if (typeof value === 'string' && (value = trim(value))) {
    const num = Number(value);
    return num == value && String(num).length === value.length;
  }
}
